﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Dynamic;

namespace ExportSolr
{
	class Program
	{
		static void Main( string[] args )
		{
		}
	}

	public interface IQualifiedDataObject
	{
		DataObjectName QualifiedName
		{ get; }
	}

	public abstract class DataObjectFlake : DynamicObject
	{

		public override IEnumerable<string> GetDynamicMemberNames()
		{
			return base.GetDynamicMemberNames();
		}
	}



	public abstract class RuleBase : DataObjectFlake, IQualifiedDataObject
	{

		public string Message
		{ get; set; }

		#region IQualifiedDataObject Members

		public DataObjectName QualifiedName
		{
			get;
			private set;
		}

		#endregion

		public abstract bool Validate( dynamic value, object context );

	}

	public class DocumentSchema : DataObjectFlake, IQualifiedDataObject
	{
		public DocumentSchema( DataObjectName qualifiedName )
		{
			this.QualifiedName = qualifiedName;
			this.Rules = new List<RuleBase>();
		}

		public List<RuleBase> Rules
		{ get; private set; }

		#region IQualifiedDataObject Members

		public DataObjectName QualifiedName
		{
			get;
			private set;
		}

		#endregion
	}

	public class Field : DataObjectFlake, IQualifiedDataObject
	{
		public string FriendlyName
		{ get; set; }

		public FlakeKind Type
		{ get; private set; }
		
		#region IQualifiedDataObject Members

		public DataObjectName QualifiedName
		{
			get;
			private set;
		}

		#endregion

		public List<RuleBase> Rules
		{ get; private set; }
	}

	public enum FlakeKind
	{
		Text = 0,
		Number = 1,
		Date = 2,
		Boolean = 3,
		Object = 4
	}

	public struct Text
	{ }

	public struct Number
	{ }

	public struct Boolen
	{ }

	public class DataObjectName
	{
		public DataObjectName( string name )
		{
			this.Name = name;
			this.Namespace = "Global";
		}

		public string Name
		{ get; private set; }

		public string Namespace
		{ get; private set; }
	}

	public class Document : DynamicObject
	{
		
	}
}
